export default function registerFamen (lf) {
  lf.register('famen', ({ CircleNode, CircleNodeModel, h }) => {
    class EndNode extends CircleNode {
      getIconShape () {
        const attributes = this.getAttributes()
        const {
          x,
          y,
          width,
          height
        } = attributes
        return h(
          'svg',
          {
            x: x - width / 2,
            y: y - height / 2,
            width: 40,
            height: 40,
            viewBox: '0 0 1024 1024'
          },
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M113.47027 525.837838h877.318919v369.47027h-877.318919z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M113.47027 711.264865h877.318919v184.043243h-877.318919zM113.47027 525.837838h877.318919v47.048648h-877.318919z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M113.47027 848.259459h877.318919v47.048649h-877.318919z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M0 492.627027v437.275676c0 31.827027 24.908108 56.735135 56.735135 56.735135s56.735135-24.908108 56.735135-56.735135V492.627027c0-31.827027-24.908108-56.735135-56.735135-56.735135S0 460.8 0 492.627027z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M113.47027 928.518919V492.627027c0-31.827027-24.908108-56.735135-56.735135-56.735135v549.362162c30.443243 0 56.735135-24.908108 56.735135-56.735135z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M965.881081 492.627027v437.275676c0 31.827027 24.908108 56.735135 56.735135 56.735135s56.735135-24.908108 56.735135-56.735135V492.627027c0-31.827027-24.908108-56.735135-56.735135-56.735135-30.443243 0-56.735135 24.908108-56.735135 56.735135z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M1079.351351 928.518919V492.627027c0-31.827027-24.908108-56.735135-56.735135-56.735135v549.362162c31.827027 0 56.735135-24.908108 56.735135-56.735135z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M366.702703 466.335135v361.167568c0 102.4 83.027027 184.043243 184.043243 184.043243 102.4 0 184.043243-83.027027 184.043243-184.043243V466.335135h-368.086486z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M687.740541 466.335135v361.167568c0 76.108108-60.886486 136.994595-136.994595 136.994594s-136.994595-60.886486-136.994595-136.994594V466.335135h-47.048648v361.167568c0 102.4 83.027027 184.043243 184.043243 184.043243 102.4 0 184.043243-83.027027 184.043243-184.043243V466.335135h-47.048648z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M550.745946 1011.545946c102.4 0 184.043243-83.027027 184.043243-184.043243V466.335135h-184.043243v545.210811z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M550.745946 1011.545946c102.4 0 184.043243-83.027027 184.043243-184.043243V466.335135h-47.048648v361.167568c0 76.108108-60.886486 136.994595-136.994595 136.994594'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M464.951351 166.054054V362.551351h179.891892V166.054054c0-49.816216-40.12973-89.945946-89.945946-89.945946s-89.945946 40.12973-89.945946 89.945946z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M644.843243 362.551351V166.054054c0-49.816216-40.12973-89.945946-89.945946-89.945946V362.551351h89.945946z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M787.372973 291.978378H332.108108c-29.059459 0-52.583784-23.524324-52.583784-52.583783 0-29.059459 23.524324-52.583784 52.583784-52.583784h384.691892c48.432432 0 95.481081-23.524324 123.156757-63.654054l35.978378-48.432433c29.059459-40.12973 74.724324-63.654054 123.156757-63.654054H1425.297297c44.281081 0 80.259459 35.978378 80.25946 80.25946 0 44.281081-35.978378 80.259459-80.25946 80.259459h-388.843243c-38.745946 0-76.108108 15.221622-105.167568 41.513514L892.540541 249.081081c-27.675676 29.059459-66.421622 42.897297-105.167568 42.897297z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M921.6 141.145946l-55.351351 52.583784c-31.827027 30.443243-74.724324 47.048649-119.005406 47.048648h-467.718919c0 29.059459 23.524324 52.583784 52.583784 52.583784h455.264865c38.745946 0 76.108108-15.221622 105.167568-41.513513l38.745945-35.978379c27.675676-26.291892 66.421622-41.513514 105.167568-41.513513H1425.297297c44.281081 0 80.259459-35.978378 80.25946-80.25946h-464.951352c-44.281081-1.383784-87.178378 15.221622-119.005405 47.048649z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M769.383784 352.864865h-435.891892c-31.827027 0-56.735135 24.908108-56.735135 56.735135s24.908108 56.735135 56.735135 56.735135h437.275676c31.827027 0 56.735135-24.908108 56.735135-56.735135-1.383784-31.827027-26.291892-56.735135-58.118919-56.735135z'
            }
          ),
          h(
            'path',
            {
              fill: '#1296db',
              d: 'M333.491892 466.335135h435.891892c31.827027 0 56.735135-24.908108 56.735135-56.735135H276.756757c0 30.443243 24.908108 56.735135 56.735135 56.735135z'
            }
          ),
        )
      }
      getShape () {
        const attributes = this.getAttributes()
        const {
          x,
          y,
          r,
          fill,
          stroke,
          strokeWidth
        } = attributes
        return h(
          'g',
          {
          },
          [
            h(
              'circle',
              {
                cx: x,
                cy: y,
                r,
                fill,
                stroke,
                strokeWidth
              }
            ),
            this.getIconShape()
          ]
        )
      }
    }
    class EndModel extends CircleNodeModel {
      constructor (data, graphModel) {
        data.text = {
          value: (data.text && data.text.value) || '阀门',
          x: data.x,
          y: data.y + 35
        }
        super(data, graphModel)
      }
    }
    return {
      view: EndNode,
      model: EndModel
    }
  })
}
